<?php echo $this->Html->css('form'); ?>
<?php echo $this->Html->css('add_category'); ?>
<?php echo $this->Html->script('ckeditor/ckeditor'); ?>

<?php
$myControl = $this->params["controller"];
$myAction = $this->params["action"];

$cont = Inflector::classify($myControl);
$act = Inflector::camelize($myAction);
?>
<?php echo $this->Form->create('Manufacturer',array('url'=>'/manufacturers/add','id' => "{$cont}{$act}Form",'enctype' => 'multipart/form-data'));?>

<div class="contentMain">
<div class="grayBox">

<div class="form_wrapper">
    <div class="title">Create new manufacturer</div>
    <ul class="addBox">
        <li>
            <span class="titleName"><label>Name</label></span>
            <?php
                echo $form->text('name', array(
                    'required' => 'required',
                    'placeholder' => 'Manufacturer name'));
                echo '&nbsp;';
                echo $form->error('name',array('class'=>'error-message'));
            ?>
        </li>
        <li>
            <span class="titleName"><label>Description</label></span>
            <?php
                echo $form->textarea('description', array(
                    'id' => 'manufacturer_desc',
                    'required' => 'required',
                    'placeholder' => 'Please provide some information about the manufacturer'
                ));
                echo '&nbsp;';
                echo $form->error('description',array('class'=>'error-message'));
            ?>
        </li>
        <li>
            <span class="titleName"><label>Url</label></span>
            <?php
                echo $form->text('url', array(
                    'required' => 'required',
                    'placeholder' => 'Manufacturer homepage',
                    'style' => 'width: 350px'));
                echo '&nbsp;';
                echo $form->error('url',array('class'=>'error-message'));
            ?>
        </li>
    </ul>
    <?=$this->Form->button(__('Save and publish', true), array('type' => 'submit', 'style'=>'display:none', 'id'=>'save_publish','name'=>'savePublish')); ?>
    <a style="margin-right:5px" class="button" href="#" onclick="$('#save_publish').click(); return false;"><span class="btnBg">Save</span></a>
    <a href="<?=$this->webroot.Controller::referer()?>" class="button"><span class="btnBg">Cancel</span></a>
</div>

</div>
</div>

<?php
echo $this->Form->end();
?>
<script>
CKEDITOR.replace( 'manufacturer_desc',
    {
        extraPlugins : 'uicolor',
        toolbar : [ ['Bold', 'Italic'], ['NumberedList'], ['Link', 'Unlink'] ],
        width: '400px'
    });
CKEDITOR.on("instanceReady", function(){
    $('#cke_manufacturer_desc').css('margin-left', '25.5%').css('margin-top', '-20px');
});
</script>
